package zkclient;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Lenovo on 2018/11/22.
 */
public class OrderFactory {

    private static Integer i=0;
    public  static String GetOrder(){
        //JDK 锁
//		synchronized (i) {
//			i++;
//			return "NewOrder"+new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-"+i).format(new Date());
//		}
        //分布式锁
        i++;
        String ss= "NewOrder"+new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-"+i).format(new Date());
        return ss;
    }
}
